/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rmiproto;

/**
 *
 * @author bisc
 */
import java.rmi.*;
import java.rmi.registry.*;
import java.net.*;
import rmiinterfaces.*;


public class RmiClientSecurity
{
    static public void main(String args[])
    {
       SecurityInterface rmiServer;
       Registry registry;
       String serverAddress=args[0];
       String serverPort=args[1];
       String text=args[2];
       System.out.println("sending "+text+" to "+serverAddress+":"+serverPort);
       try{
           // get the �gregistry�h
           registry=LocateRegistry.getRegistry(
               serverAddress,
               (new Integer(serverPort)).intValue()
           );
           // look up the remote object
           
           Remote obj = (registry.lookup("securityFacade"));
           System.out.println(obj.toString());
           
           rmiServer= (SecurityInterface) obj; 
              
           // call the remote method
           System.out.println(rmiServer.logIn("as","asdq").toString());
       }
       catch(RemoteException e){
           e.printStackTrace();
       }
       catch(NotBoundException e){
           e.printStackTrace();
       }
    }
}